package com.niiwoo.civet.trade.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 订单查询状态 -----> 投资订单衍变状态
 * 订单状态-0:全部，1正常回款，2已逾期，3投资中，4已结清，5已关闭
 * 投资订单衍变状态（0处理中，1投资中，2回款中，3回款逾期，4已关闭，5已结清，6转让中，7已转让）
 */
@Getter
@AllArgsConstructor
public enum InvestOrderStatusEnum {

    ALL((byte) 0, "全部", null),
    BACKING((byte) 1, "正常回款", ProjectInvestOrderEvolutionStatusEnum.BACKING),
    BACKING_OVERDUE((byte) 2, "已逾期", ProjectInvestOrderEvolutionStatusEnum.BACKING_OVERDUE),
    INVESTING((byte) 3, "投资中", ProjectInvestOrderEvolutionStatusEnum.INVESTING),
    ALL_BACKED((byte) 4, "已结清", ProjectInvestOrderEvolutionStatusEnum.ALL_BACKED),
    CLOSED((byte) 5, "已关闭", ProjectInvestOrderEvolutionStatusEnum.CLOSED);


    private Byte type;
    private String desc;
    private ProjectInvestOrderEvolutionStatusEnum evolutionStatusEnum;

    public static InvestOrderStatusEnum typeOf(Byte type) {
        for (InvestOrderStatusEnum typeEnum : values()) {
            if (typeEnum.getType().equals(type)) {
                return typeEnum;
            }
        }
        return InvestOrderStatusEnum.ALL;
    }
}
